import {RouterModule, Routes} from '@angular/router';
import {NgModule} from '@angular/core';
import {PageNotFoundComponent} from './error/page-not-found/page-not-found.component';
import {LayoutComponent} from './layout/layout/layout.component';
import {DashboardComponent} from './layout/dashboard/dashboard.component';

export const appRoutes: Routes = [
  {
    path: '', component: LayoutComponent,
    children: [
      {path: '', pathMatch: 'full', component: DashboardComponent},
      {
        path: 'config',
        loadChildren: 'app/config/config.module#ConfigModule'
      },
      {
        path: 'account',
        loadChildren: 'app/account/account.module#AccountModule'
      },
    ]
  },
  {path: '404', component: PageNotFoundComponent},
  {path: '**', redirectTo: '/404'}
];

@NgModule({
  imports: [
    RouterModule.forRoot(
      appRoutes,
      {enableTracing: true} // <-- debugging purposes only
    )
  ],
  exports: [
    RouterModule
  ]
})
export class AppRoutingModule {
}
